package com.example.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.dao.UserDao;
import com.example.pojo.User;
import com.example.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserDao userDao;


    @Override
    public List<User> findAll() {
        return userDao.selectList(null);
    }

    @Override
    public void del(Long id) {
         userDao.deleteById(id);
    }

    @Override
    public void add(User user) {
        userDao.insert(user);
    }

    @Override
    public void update(User user) {
        userDao.updateById(user);
    }

    @Override
    public User findById(Long id) {
        User user=userDao.selectById(id);
        return user;
    }
}
